package study.javaee.practice.service;

import org.springframework.lang.Nullable;
import study.javaee.practice.entity.User;

/**
 * 用户缓存
 */
public interface UserCacheService {
    /**
     * 设置图片验证码内容
     */
    boolean setImgAuthCode(String email, String code);
    /**
     * 获取图片验证码内容
     */
    @Nullable
    String getImgAuthCode(String email);
    /**
     * 设置邮箱验证码
     * @param email 邮箱
     * @param usage 用途， 例如 登录、注册、修改密码
     */
    void setEmailVerCode(String email, String usage, String code);
    /**
     * 获取邮箱验证码
     */
    @Nullable
    String getEmailVerCode(String email, String usage);

    void deleteEmailVerCode(String email, String usage);

    /**
     * 缓存用户
     */
    void setUser(String email, User user);

    /**
     * 获取缓存用户
     */
    User getUser(String email);

    void deleteUser(String email);
}
